package thread;

class MyRunnable implements Runnable{
    @Override
    public void run() {
        //线程入口方法
        while (true){
            System.out.println("hello thread");
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }

    }
}

public class Demo2 {
    public static void main(String[] args) throws InterruptedException {
        Runnable r = new MyRunnable();
        Thread t1 = new Thread(r);
        t1.start();
        while(true){
            System.out.println("hello main");
            Thread.sleep(100);
        }
    }
}
